package com.qianxunclub.redis;

import java.util.concurrent.TimeUnit;

import org.springframework.data.redis.core.RedisTemplate;

import com.qianxunclub.util.SpringContextUtil;
public class RedisCatch {
	private static RedisTemplate<String,Object> redisTemplate = SpringContextUtil.getBean("redisTemplate");
	public static void put(String key,Object value){
		redisTemplate.opsForValue().set(key, value,2,TimeUnit.DAYS);
	}
	public static void put(String key, Object value, int timeout, TimeUnit days) {
		redisTemplate.opsForValue().set(key, value,timeout,days);
	}
	public static Object get(Object key){
		return redisTemplate.opsForValue().get(key);
	}
	public static void delete(String key){
		redisTemplate.delete(key);
	}
}
